/**
 * Copyright (C), 2019-2023,
 * FileName: TestCLient
 * Author:   fanxquer
 * Date:     2023/7/6 10:36
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 邱富康           2023/7/6           1.0
 */
package com.hsteach.framework.feign.client.xgk;

import com.alibaba.fastjson2.JSONObject;
import com.hsteach.framework.feign.ClientConstant;
import com.hsteach.framework.feign.client.FeignConfig;
import com.hsteach.framework.feign.client.xgk.dto.*;
import com.hsteach.framework.feign.client.xgk.dto.ret.*;
import com.hsteach.framework.feign.client.xgk.dto.ret.preschool.PreschoolGetParentsRet;
import com.hsteach.framework.feign.client.xgk.dto.ret.preschool.PreschoolGetTeacherRet;
import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 〈〉
 *
 * @author Qiu Fukang
 * @create 2023/7/6
 * @since 1.0.0
 */
@FeignClient(name = "xgkClient", url = "${interface.xgk.domain:127.0.0.1:8079}", configuration = FeignConfig.class)
public interface XgkClient {

    /**
     * 登录
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isptl/open/sso/login")
    XgkDataResp<JSONObject> login(@RequestBody XgkReq<LoginEntity> req);

    /**
     * 获取机构全量人员列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getPersonByDatabase")
    XgkListResp<GetPersonByDatabaseRet> getPersonByDatabase(@RequestBody XgkReq req);

    /**
     * 查询教师列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getTeachers")
    XgkListResp<GetTeacherRet> getTeachers(@RequestBody XgkReq req);

    /**
     * 查询教师列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getTeachersByClassId")
    XgkListResp<GetTeacherRet> getTeachersByClassId(@RequestBody XgkReq<GetTeacherInfoEntity> req);


    /**
     * 通过班级/年级查询学生列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getStudentListByGradeAndClass")
    XgkListResp<PersonInfoRet> getStudentListByGradeAndClass(@RequestBody XgkReq<GetStudentListByGradeAndClassEntity> req);


    /**
     * 根据id查询班级信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/class/getClassListByIds")
    XgkListResp<GetClassListByIdsRet> getClassListByIds(@RequestBody XgkReq<GetClassListByIdsEntity> req);

    /**
     * 获取人员额外信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getPersonRelations")
    XgkDataResp<GetPersonRelationsRet> getPersonRelations(@RequestHeader(ClientConstant.XGK_TOKEN) String token,
                                                          @RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                          @RequestBody XgkReq<GetPersonRelationsEntity> req);

    /**
     * 根据personId查询学生信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getPersonInfoList")
    XgkListResp<PersonInfoRet> getPersonInfoList(@RequestBody XgkReq<GetStudentListByPersonIdsEntity> req);

    @PostMapping("/xgk/service/isbmp/person/getPersonInfoList")
    XgkListResp<PersonInfoRet> getPersonInfoListNoToken(@RequestHeader(ClientConstant.XGK_TOKEN) String token,
                                                        @RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                        @RequestBody XgkReq<GetStudentListByPersonIdsEntity> req);

    /**
     * AccessToken和appToken获取orgCode和token
     * @param req
     * @return
     */
    @Headers({"appId:JF-ISWCC-WEB"})
    @PostMapping("/xgk/service/isptl/open/public/loginByAccessToken")
    XgkDataResp<LoginByAccessTokenRet> loginByAccessToken(@RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                                                          @RequestHeader(ClientConstant.XGK_TIME_STAMP) Long timeStamp,
                                                          @RequestHeader(ClientConstant.XGK_APP_ID) String appId,
                                                          @RequestBody XgkReq<LoginByAccessTokenEntity> req);

    /**
     * 获取当前账号家长通讯录
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getParents")
    XgkListResp<GetParentsRet> getParents(@RequestBody XgkReq req);

    /**
     * 获取班级树
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/class/getSchoolPartTree")
    XgkDataResp<GetSchoolPartTreeRet> getSchoolPartTree(@RequestBody XgkReq req);

    /**
     * 根据学校id获取班级树
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/class/getSchoolPartTree")
    XgkDataResp<GetSchoolPartTreeRet> getClassTreeBySchoolId(@RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,@RequestBody XgkReq req);

    /**
     * 获取班级树（根据当前用户权限）
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/class/getSchoolPartTreeAuth")
    XgkDataResp<GetSchoolPartTreeRet> getSchoolPartTreeAuth(@RequestBody XgkReq req);

    /**
     * 获取学段
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp /sertionGrade/getSectionGradeList")
    XgkListResp<GetSectionGradeListRet> getSectionGradeList(@RequestBody XgkReq req);

    /**
     * 获取年级列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/sertionGrade/getGradeList")
    XgkDataResp<GetGradeListRet> getGradeList(@RequestBody XgkReq<GetGradeListEntity> req);

    /**
     * 按照班级列表获取学生
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getClazzWithStudents")
    XgkListResp<GetClazzWithStudentsRet> getClazzWithStudents(@RequestBody XgkReq req);

    /**
     * 根据大平台人员id返回personId
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getPersonIdByThirdPersonId")
    XgkDataResp<String> getPersonIdByThirdPersonId(@RequestHeader(ClientConstant.XGK_TOKEN) String token,
                                                   @RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                   @RequestBody XgkReq<GetPersonIdByThirdPersonIdEntity> req);

    /**
     * 获取登录token信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/public/getSessionInfo")
    XgkDataResp<GetSessionInfoRet> getSessionInfo(@RequestHeader(ClientConstant.XGK_TOKEN) String token,
                                                  @RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                  @RequestBody XgkReq req);



    /**
     * 根据buildingId查询子树信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/place/getPlaceChildrenTree")
    XgkDataResp<GetPlaceChildrenTreeRet> getPlaceChildrenTree(@RequestBody XgkReq<GetPlaceChildrenTreeEntity> req);

    /**
     * 获取场所树
     * @param orgCode
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/place/getPlaceTree")
    XgkDataResp<GetPlaceChildrenTreeRet> getPlaceTree(@RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                      @RequestBody XgkReq req);

    /**
     * 根据（校区、楼栋、楼层，均可空）获取教室列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/place/getClassRoomListByPlaceId")
    XgkListResp<GetClassRoomListByPlaceIdRet> getClassRoomListByPlaceId(@RequestBody XgkReq<GetClassRoomListByPlaceIdEntity> req);


    /**
     * 获取部门组织树
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/organ/getAdmOrgTree")
    XgkDataResp<GetOrgTreeListByPlaceIdRet> getAdmOrgTreed(@RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
            @RequestBody XgkReq<GetOrgTreeListByPlaceIdEntity> req);

    /**
     * 获取部门组织下人员列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/organ/getAdmBraPerList")
    XgkDataResp<GetDataListVo<GetAdmBraPerListRet>> getAdmBraPerList(@RequestBody XgkReq<GetOrgTreeListByPlaceIdEntity> req);


    /**
     * 通过机构列表和人员名称查询人员列表(分页)
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/organ/getPersonListByOrganListWithPages")
    XgkDataResp<GetDataListVo<GetPersonListByOrgListAndPersonNameRet>> getPersonListByOrganListWithPages(@RequestBody XgkReq<GetPersonListByOrgListAndPersonNameEntity> req);

    /**
     * 根据场所id 和 日期 获取课表信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/iscms-gateway-service/timetableQuery/querySinglePlaceTable")
    XgkListResp<QuerySinglePlaceTableRet> querySinglePlaceTable(@RequestBody XgkReq<QuerySinglePlaceTableEntity> req);


    /**
     * 获取用户权限数据
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/public/getUserInfo")
    XgkDataResp<GetUserInfoRet> getUserInfo(@RequestHeader(ClientConstant.XGK_TOKEN) String token,
                                            @RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                            @RequestBody XgkReq<GetUserInfoEntity> req);


    /**
     * 获取教学机构树
     * @param orgCode
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/unit/getTeaOrgTree")
    XgkDataResp<GetTeaOrgTreeRet> getTeaOrgTree(@RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                      @RequestBody XgkReq req);

    /**
     * 获取教学机构人员信息
     * @param orgCode
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/unit/getOrganPersonList")
    XgkDataResp<GetDataListVo<GetOrganPersonListRet>> getOrganPersonList(@RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                                         @RequestBody XgkReq<GetOrganPersonListEntity> req);

    /**
     * 根据spyCode查询拥有当前菜单权限的所有人员
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getPersonBySpyCode")
    XgkListResp<GetPersonBySpyCodeRet> getPersonBySpyCode(@RequestBody XgkReq<GetPersonBySpyCodeEntity> req);

    /**
     * 获取学年列表
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/accYear/getYearList")
    XgkListResp<GetYearListRet> getYearList(@RequestBody XgkReq req);

    // todo mgb 三方接口对接
    @PostMapping("/xgk/service/isbmp/class/getClassTeacher")
    XgkListResp<GetTeacherRet> getClassTeacher(@RequestHeader(ClientConstant.XGK_TOKEN) String token,
                                                @RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode,
                                                @RequestBody XgkReq<GetTeacherInfoEntity> req);

    /**
     * 通过班级或年级查询教师
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getTeacherListByGradeAndClass")
    XgkListResp<PersonInfoRet> getTeacherListByGradeAndClass(@RequestBody XgkReq<GetStudentListByGradeAndClassEntity> req);

    /**
     * 获取教师通讯录
     * @param
     * @return
     */
    @GetMapping("/xgk/iscbmp/iscbmpwebgateway/v1/eclass/teachers/communicationinfo")
    XgkListResp<PreschoolGetTeacherRet> getPreschoolTeachers(@RequestParam(ClientConstant.XGK_ACCESS_TOKEN) String accessToken);

    /**
     * 获取家长通讯录
     * @param accessToken
     * @return
     */
    @GetMapping("/xgk/iscbmp/iscbmpwebgateway/v1/eclass/parents/communicationinfo")
    XgkListResp<PreschoolGetParentsRet> getParentList(@RequestParam(ClientConstant.XGK_ACCESS_TOKEN) String accessToken);


    /**
     * 获取幼教基础人员信息
     * @param
     * @return
     */
    @GetMapping("/xgk/iscbmp/iscbmpwebgateway/v1/persons/transfer/info/personid")
    XgkDataResp<JSONObject> getPrePersonInfo(@RequestParam("person_id") String person_id, @RequestParam("school_id") String school_id);

    /**
     * 获取职务
     * @param req
     * @return
     */
    @PostMapping("/xgk/iscbmp/iscbmpwebgateway/v1/teachers/organ/dutys")
    XgkListResp<JSONObject> getAllDutys(@RequestBody JSONObject req);

    /**
     * 通过学校id查询所有学生
     * @param
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getSchoolsStudents")
    XgkListResp<StudentRet> getStudentBySchoolId(@RequestHeader(ClientConstant.XGK_ORG_CODE) String orgCode, @RequestBody JSONObject jsonObject);


    /**
     * 获取指定学校的基础数据：学校名称，学生数量
     * 不传参获取所有学校
     * @param
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/getSchoolCount")
    XgkListResp<SchoolRet> getSchool(JSONObject jsonObject);

    /**
     * 根据personId查询学生信息
     * @param req
     * @return
     */
    @PostMapping("/xgk/service/isbmp/person/open/getPersonByPersonIds")
    XgkListResp<PersonRet> getPersonListByPersonIds(@RequestHeader("appid") String appid,
                                                    @RequestHeader("apptoken") String apptoken,
                                                    @RequestHeader("Timestamp") String Timestamp,
                                                    @RequestBody XgkReq<GetStudentListByPersonIdsEntity> req);
}
